#include "enemy.h"

#include <cmath>
#include <algorithm>

void Enemy::draw()
{
	//glColor3fv( &color[i][0] );
	//glColor3f(frand(),frand(),frand());

	float radi = 1;
	int segs = segments;

	for(int j=0; j<segs; j++)
	{
		float ang = (float)j * 2*3.14159f/(segs);
		float x1 = _x + cos(ang)*radi;
		float y1 = _y + sin(ang)*radi;


		ang = (float)(j+1) * 2*3.14159f/(segs);
		float x2 = _x + cos(ang)*radi;
		float y2 = _y + sin(ang)*radi;

		graphics->DrawLine(x1,y1,x2,y2,2.0f);
	}
}

Enemy::Enemy()
{
	segments = std::max(3, 8*rand()/RAND_MAX );
}
